import request from '@/utils/request'
import { getToken } from '@/utils/auth'
// import { getToken } from '@/utils/auth'

export function getAllocation(query) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/pas/allocation/getAllocation',
    method: 'get',
    params: query
  })
}

export function addAllocationRecord(data) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/pas/allocation/addAllocationRecord',
    method: 'post',
    data
  })
}

export function querySkuInfoBySkuName(skuName, warehouseId) {
  var url = '/wxh-cloud-rest/rest/' + getToken() + '/pas/sku/querySkuInfoBySkuName?skuName=' + skuName
  if (warehouseId) {
    url += '&warehouseId=' + warehouseId
  }
  return request({
    url,
    method: 'get'
  })
}

export function allocationReceive(data) {
  return request({
    url: '/wxh-cloud-rest/rest/' + getToken() + '/pas/allocation/allocationReceive',
    method: 'post',
    headers: { 'Content-Type': 'multipart/form-data' },
    params: data
  })
}

